package com.o2opuzi.pub.dao

import org.springframework.stereotype.Repository;

import com.alibaba.fastjson.JSON;
import com.o2opuzi.lib.db.SupportDao;
import com.o2opuzi.pub.model.Config;

@Repository
class ConfigDao extends SupportDao<Config>{
	
	/**
	 * 获取配置信息
	 * @auther Y.hj
	 * @param name
	 * @return
	 */
	def Config getConfig(String name){
		return findBy("config_key = ?",name);
	}
	
	def getJSONMapConfig(String name){
		def conf = getConfig(name);
		if(conf != null){
			return JSON.parseObject(conf.config_value, Map.class);
		}
		return [:];
	}
	
	
}
